<template>
  <div class="page">
    <div class='content' v-html="details"></div>
  </div>
</template>

<script>
import { goodsDetails } from 'api/goods'

export default {
  name: 'goods-content',
  data () {
    return {
      details: ''
    }
  },
  methods: {
    init () {
      goodsDetails(this.gid).then(res => {
        if (res.code === 200) {
          this.details = res.data.bodys
        } else {
          this.details = ''
        }
      })
    }
  },
  created () {
    this.gid = this.$route.query.gid || ''
    this.init()
  },
  beforeRouteUpdate (to, from, next) {
    this.gid = to.query.gid || ''
    this.init()
    next()
  }
}
</script>

<style scoped>
  .page {
    margin-top: 1.2rem;
  }

  .content {
    width: 90%;
    margin: 0 auto;
    font-size: 0.32rem;
    line-height: 0.5rem;
  }
</style>
